package com.atguigu.cloud.exception;

import com.atguigu.cloud.myEnum.ReturnCodeEnum;
import com.atguigu.cloud.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 全局异常
 */
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
//    @ExceptionHandler(RuntimeException.class)
//    @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
//    public Result<String> exception(Exception e) {
//        log.error("请求失败：",e);
//        return Result.fail(ReturnCodeEnum.FAIL.getValue(), e.getMessage());
//    }
}
